<input type="hidden" id="wall_post_form_status" value="<?php echo $this->session->flashdata('wall_post_form_status'); ?>" />
<input type="hidden" id="wall_post_form_message" value="<?php echo $this->session->flashdata('wall_post_form_message'); ?>" />
<input type="hidden" id="wall_wall_post_id" value="<?php echo $this->session->flashdata('wall_wall_post_id'); ?>" />
<input type="hidden" id="wall_wall_post_hash" value="<?php echo $this->session->flashdata('wall_wall_post_hash'); ?>" />
<script type="text/javascript">
  $(document).ready(function() {
    $('#wall_post').wysihtml5();
    var new_tweet_status = $.trim($('#wall_post_form_status').val());
    if (new_tweet_status == 1) {
      toastr.success('Successfully posted !');
    }
    if (new_tweet_status == 2) {
      toastr.error('Error occured !');
    }
    var wall_wall_post_id = $.trim($('#wall_wall_post_id').val());
    var wall_wall_post_hash = $.trim($('#wall_wall_post_hash').val());
    if ((wall_wall_post_id) && (wall_wall_post_hash)) {
      send_notification('new_wall_post', wall_wall_post_id, wall_wall_post_hash);
    }
    update_likes_count();
  });
</script>
<div class="page" style="min-height: 500px;">
  <div class="page-container">
    <div class="container">
      <div class="row">
        <div class="span12">
          <div class="btn-group pull-right">
            <a href="<?php echo base_url('profile/' . $user_data['user_name']); ?>" class="btn">Profile</a>
            <a href="<?php echo base_url('wall/' . $user_data['user_name']); ?>" class="btn active">Wall</a>
            <?php if (($this->current_user['user_name'] == $user_data['user_name']) || ($this->is_admin)) { ?>
              <a href="<?php echo base_url('activity/' . $user_data['user_name']); ?>" class="btn">Activity</a>
            <?php } ?>
            <?php if (($this->is_admin) && (!check_is_admin($user_data['user_name']))) { ?>
              <a onclick="return confirm_action('Disable this user ?');" title="Disable this user. Incase of Resign etc.." href="<?php echo base_url('users/disable/' . $user_data['user_name']); ?>" class="btn">Disable</a>
            <?php } ?>
          </div>
          <h4 class="header">Wall : <?php echo $user_data['user_display_name']; ?></h4>
        </div>
        <div class="span3">
          <div class="img-rounded thumbnail">
            <img style="width: 250px;" border="0" src="<?php echo base_url('assets/photos/' . $user_data['user_image']); ?>">
          </div>
          <div class="clearfix"></div>
          <div class="filters">
            <h5><?php echo '@' . $user_data['user_name']; ?></h5>
            <?php if ($user_data['user_is_user'] == 1) { ?>
              <span class="pull-right"><?php echo date('d - M', strtotime($user_data['user_birthday_date'])); ?></span>
              <label for="cb3">Birthday</label>
              <span class="pull-right"><?php echo date('d - M - Y', strtotime($user_data['user_join_date'])); ?></span>
              <label for="cb3">Join Date</label>
            <?php } ?>
            <?php if (!empty($wall_post_extras_data)) { ?>
              <h5>Counter</h5>
              <span class="pull-right"><?php echo $wall_post_extras_data['wall_post_total_count']; ?></span>
              <label for="cb3">Total posts</label>
              <span class="pull-right"><?php echo $wall_post_extras_data['your_wall_post_total_count']; ?></span>
              <label for="cb3">Your posts</label>
            <?php } ?>
          </div>
        </div>
        <div class="span9">
          <div class="messages">
            <div class="message">
              <a href="<?php echo base_url('profile/' . $this->current_user['user_name']); ?>"><img title="<?php echo $this->current_user['user_display_name']; ?>" src="<?php echo base_url('assets/photos/' . $this->current_user['user_image']); ?>" class="img-rounded pull-left" style="max-height: 60px; max-width: 60px;"/></a>
              <div class="message-body">
                <form method="post" action="<?php echo base_url('wall/' . $user_data['user_name']); ?>">
                  <input type="hidden" name="csrf_token" value="<?php echo set_csrf_token(); ?>"/>
                  <textarea id="wall_post" name="wall_post" placeholder="Enter your post"></textarea>
                  <a class="badge badge-info" id="malayalam_button" style="float: right; cursor: pointer; margin-right: 15px; text-decoration: none;" onclick="return write_malayalam('wall_post');">malaylam</a>
                  <input type="submit" class="btn" value="Post" onclick="return validate_post();"/>
                  <?php $wall_post_form_message = $this->session->flashdata('wall_post_form_message'); ?>
                  <?php if ($wall_post_form_message == 'Success :)') { ?>
                    <label style="float: right; margin-right: 15px; color: yellowgreen;"><?php echo $wall_post_form_message; ?></label>
                  <?php } else { ?>
                    <label style="float: right; margin-right: 15px; color: tomato;"><?php echo $wall_post_form_message; ?></label>
                  <?php } ?>
                </form>
              </div>
            </div>
            <?php if (!empty($wall_post_data)) { ?>
              <?php foreach ($wall_post_data as $wall_post) { ?>
                <?php $wall_uid = '#W' . $wall_post['wall_post_id']; ?>
                <div class="message">
                  <a href="<?php echo base_url('profile/' . $wall_post['user_name']); ?>"><img title="<?php echo $wall_post['user_display_name']; ?>" src="<?php echo base_url('assets/photos/' . $wall_post['user_image']); ?>" class="img-rounded pull-left" style="max-height: 60px; max-width: 60px;"/></a>
                  <div class="message-body">
                    <p class="pull-right">
                      <a style="text-decoration: none; cursor: pointer; color: salmon;" href="#wall_post_<?php echo $wall_post['wall_post_id']; ?>">&nbsp;&nbsp;<?php echo $wall_uid; ?></a>
                    </p>
                    <p class="pull-right">&nbsp;(<?php echo time_ago($wall_post['wall_post_date']); ?> ago)</p>
                    <?php if ($this->current_user['user_id'] == $wall_post['user_id'] || $this->current_user['user_id'] == $user_data['user_id'] || $this->is_admin) { ?>
                      <a onclick="return confirm_action('Delete wall post ?');" style="text-decoration: none;" href="<?php echo base_url('wall/' . $user_data['user_name'] . '/delete/' . $wall_post['wall_post_id']); ?>"><span style="color: #f8b9b7; float: right; margin-right: 10px;" title="Delete reply"><i class="icon-large icon-trash"></i></span></a>
                    <?php } ?>
                    <?php if ($this->current_user['user_id'] != $wall_post['user_id']) { ?>
                      <a onclick="return reply_to_user('wall_post', '<?php echo $wall_post['user_name']; ?>', '<?php echo $wall_uid; ?>');" style="text-decoration: none; cursor: pointer;"><span style="color: skyblue; float: right; margin-right: 10px;" title="Reply to this user"><i class="icon-large icon-retweet"></i></span></a>
                    <?php } ?>
                    <span style="float: right; margin-right: 10px;">
                      <?php $get_user_like_status = get_user_like_status('wall_post', $wall_post['wall_post_id']); ?>
                      <?php if ($get_user_like_status['status'] == 'yes') { ?>
                        <a title="Unlike" style="text-decoration: none; cursor: pointer; color: yellowgreen;" id="like_button_wall_post_<?php echo $wall_post['wall_post_id']; ?>" onclick="return do_like_action('wall_post', '<?php echo $wall_post['wall_post_id']; ?>', '0');"><i class="icon-large icon-thumbs-down"></i></a>
                      <?php } else { ?>
                        <a title="Like" style="text-decoration: none; cursor: pointer; color: yellowgreen;" id="like_button_wall_post_<?php echo $wall_post['wall_post_id']; ?>" onclick="return do_like_action('wall_post', '<?php echo $wall_post['wall_post_id']; ?>', '1');"><i class="icon-large icon-thumbs-up"></i></a>
                      <?php } ?>
                    </span>
                    <a class="update_like_count" title="Show users who like this" onclick="return show_liked_users('wall_post', '<?php echo $wall_post['wall_post_id']; ?>');" style="text-decoration: none; color: #777; float: right; margin-right: 10px; cursor: pointer;" id="like_count_wall_post_<?php echo $wall_post['wall_post_id']; ?>"><?php echo $get_user_like_status['total_count']; ?> Likes</a>
                    <h5>
                      <?php echo $wall_post['user_display_name']; ?>
                      &nbsp;
                      <span style="color: #777; font-size: smaller;">(@<?php echo $wall_post['user_name']; ?>)</span>
                      &nbsp;
                      <?php if (is_online($wall_post['user_id'])) { ?>
                        <img src="<?php echo site_url('assets/img/online_button_tiny.png'); ?>" title="Online"/>
                      <?php } else { ?>
                        <img src="<?php echo site_url('assets/img/offline_button_tiny.png'); ?>" title="Offline"/>
                      <?php } ?>
                    </h5>
                    <p style="word-break: normal;"><?php echo nl2br(parse_smileys($wall_post['wall_post_message'], base_url('assets/smileys'))); ?></p>
                  </div>
                </div>
              <?php } ?>
              <div id="load_more"></div>
              <?php if (isset($wall_post_extras_data['wall_post_total_count'])) { ?>
                <?php if ($wall_post_extras_data['wall_post_total_count'] >= $limit) { ?>
                  <a id="load_more_button" style="text-decoration: none; cursor: pointer; float: right; color: black" href="<?php echo base_url('wall/' . $user_data['user_name'] . '?limit=' . ($limit + 10) . '#load_more'); ?>" title="Load more wall posts">
                    <span>more</span>&nbsp;<i class="icon-large icon-chevron-down"></i>
                  </a>
                <?php } ?>
              <?php } ?>
            <?php } else { ?>
              No posts yet !
            <?php } ?>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>